package com.atguigu.spzx.cloud.gateway.configuration;

import org.springframework.cloud.gateway.filter.ratelimit.KeyResolver;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import reactor.core.publisher.Mono;

//@Configuration
public class GatewayConfig {

    //获取目标ip地址
    @Bean
    public KeyResolver ipAddressResolver() {
        return exchange -> Mono.just(exchange.getRequest().getRemoteAddress().getHostName());
    }
}